
set(DEPLOYWIN_TARGET "@DEPLOYWIN_TARGET@")
set(DEPLOYWIN_TARGET_DIR "${CMAKE_INSTALL_PREFIX}/@DEPLOYWIN_TARGET_DIR@")
set(DEPLOYWIN_BUILD @DEPLOYWIN_BUILD@)
if(DEPLOYWIN_BUILD)
#主要用cmd.exe判断是不是Windows
find_program(CMD NAMES cmd.exe)
find_program(TARGET_EXECUTABLE 
		NAMES ${DEPLOYWIN_TARGET} 
		PATHS ${DEPLOYWIN_TARGET_DIR}
		NO_SYSTEM_ENVIRONMENT_PATH
		NO_CMAKE_SYSTEM_PATH)
if(NOT TARGET_EXECUTABLE-NOTFOUND)
#string(REPLACE "/" "\\" TARGET_EXECUTABLE ${TARGET_EXECUTABLE})
if(NOT CMD-NOTFOUND)
#启用DeployWin
set(ENV{DEPLOYWIN} 1)
#启用DeployWin自动退出
set(ENV{DEPLOYWIN_AUTOEXIT} 5)
message(NOTICE Execute:"${TARGET_EXECUTABLE}")
execute_process(COMMAND "${TARGET_EXECUTABLE}"
		WORKING_DIRECTORY "${DEPLOYWIN_TARGET_DIR}"
		)
endif()
endif()
endif()
